package com.cat.dataStructure;

import java.util.PriorityQueue;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/maximum-product-after-k-increments/
 * @create 2025/10/6 16:30
 * @since JDK17
 */

public class Solution99 {
    int N = ((int) (1e9 + 7));
    public int maximumProduct(int[] nums, int k) {
        PriorityQueue<Integer> heap = new PriorityQueue<>();
        int ans = 1;
        for (int num : nums) {
            heap.add(num);
        }
        while (k-- > 0) {
            int x = heap.poll();
            heap.add(x + 1);
        }
        while (!heap.isEmpty()) {
            int x = heap.poll();
            ans *= x;
        }

        return ans;
    }
}
